package trastienda.web;

import java.util.ArrayList;
import java.util.Collection;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;


import trastienda.modelo.Usuario;
import trastienda.service.UsuarioService;

@Controller
public class IndexController {
	
	@Autowired
	private UsuarioService usuarioService;
	
	
	
	public void setUsuarioService(UsuarioService usuarioService) {
		this.usuarioService = usuarioService;
	}



	@RequestMapping(value = "/index", method = RequestMethod.GET)	
	protected ModelAndView inicio(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		
		//String a = request.getParameter("txtOperadorA");

		//Collection<String> cadenas = new ArrayList<String>();
		
		//request.setAttribute("LISTA", cadenas);
		
		Collection<Usuario> lista = null;
		lista = usuarioService.listarTodos();
		
		return new ModelAndView("logeo", "USUARIOS", lista);
	}

}
